// pages/videoDetail/videoDetail.js
Page({

  data: {
    // videoInfo.img  videoInfo.video
    videoInfo: {},
    baseURL: "http://192.168.1.20:3000/"
  },


  onLoad() {
    var app = getApp();
    this.setData({
      videoInfo: app.videoInfo
    })
  },
  // 点击下载视频
  download() {
    // 1 先将视频下载到小程序内存中
    wx.downloadFile({
      url: this.data.baseURL + this.data.videoInfo.video, //仅为示例，并非真实的资源
      success(res) {
        // 临时地址
        var tempFilePath = res.tempFilePath;
        // 2 再将内存中的视频下载到 手机存储上
        wx.saveVideoToPhotosAlbum({
          filePath: tempFilePath,
          success: (result) => {
            console.log(result);
          }
        });
      }
    })
  }
})